Copying garbage collection for WAM-based prolog systems

نویسنده

  • Ruben Vandeginste
چکیده

High-level programming languages like Prolog free the programmer from the burden of explicit memory management. In Prolog, dynamic memory allocation is done implicitly by creating data structures. The deallocation of data structures which are no longer in use, is the responsibility of the run-time system. Many Prolog implementations are based on the Warren Abstract Machine (WAM), a virtual machine with an accompanying instruction set, optimised for the execution of Prolog code. The WAM has a built-in mechanism, instant reclaiming, to recover memory on the heap at a constant cost upon backtracking. This mechanism alone, however, is not sufficient for large or mostly deterministic applications. As such, most Prolog implementations use a garbage collector for the heap. Mark-slide garbage collection has always been popular in the context of Prolog because of its intrinsic properties. Still, while the cost of mark-slide garbage collection is linear in the total number of heap cells, the cost of copying garbage collection is linear in the number of live heap cells. The survival rate of heap cells in Prolog applications is typically low and this suggests that copying garbage collection is a better choice for Prolog. On the other hand, copying garbage collection does not preserve the cell order and this leads to some disadvantages. In this dissertation, we develop techniques to make copying garbage collection for WAM-based Prolog systems better in several areas. In the context of Prolog, a standard copying algorithm copies heap cells in specific cell configurations more than once. To prevent this, copying collectors for Prolog typically employ a marking phase which precedes the copying phase. We examine under which circumstances heap cells are copied twice or more and present techniques to reduce and limit the number of extra copies. We investigate whether copying without marking is feasible in the context of Prolog. Instant reclaiming depends on the order of the heap segments. Since copying collectors are not order preserving, instant reclaiming is not possible on collected parts of the heap. We develop a technique to preserve the segment order in a copying collector and make instant reclaiming compatible with copying collection. Generational garbage collection improves the efficiency of simple collectors by collecting only those parts of the heap that likely contain the most garbage. We show that, in the context of Prolog, the cost of generational garbage collection is very low when heap segments are used as the basis for generations. This, however, requires that the segment order is preserved during collection. We develop a multigenerational copying garbage collector, based on our segment order preserving copying algorithm. A drawback of simple copying collectors is that during each collection cycle, the whole heap is collected at once. When the heap is large, this leads to big pause times and this is undesirable for certain types of applications. We develop an incremental garbage collector, which collects only a small piece of the heap during each collection cycle with the purpose of minimising the pause time. Geheugenrecuperatie door kopiëren voor Prolog systemen gebaseerd op de WAM

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Incremental copying garbage collection for WAM-based Prolog systems

We present an incremental copying garbage collector for the heap in WAM-based Prolog systems. We describe a heap layout in which the heap is divided in a number of equal-sized blocks. Other changes to the standard WAM allow to garbage collect these blocks independently from each other. Independent collection of heap blocks is the basis of our incremental algorithm. Compared to other copying col...

متن کامل

Heap Memory Management in Prolog with Tabling: Principles and Practice

We address memory management aspects of WAM-based logic programming systems that support tabled evaluation through the use of a suspension/resumption mechanism. We describe the memory organization and usefulness logic of such systems, and issues that have to be resolved for effective and efficient garbage collection. Special attention is given to early reset in the context of suspended computat...

متن کامل

Garbage Collection for Prolog based on Twin Cells

A garbage collection algorithm for a WAM-based Prolog system is presented. It uses a classical mark-and-compact approach, but requires less passes through the data areas than previous algorithms. It is applicable when the smallest garbage-collectable entity occupies an amount of space which is suucient to store two pointers plus 2 bits with each pointer. This collector has been implemented in t...

متن کامل

On Enabling the WAM with Region Support

Region-based memory management is an attractive alternative to garbage collection. It relies on a compile-time analysis to annotate the program with explicit allocation and deallocation instructions, where lifetimes of memory objects are grouped together in regions. This paper investigates how to adapt the runtime part of region-based memory management to the WAM setting. We present additions t...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2007